/**
Date: 2025-08-13
Copyright (c) 2025 Industrial Software Feature Database
*/
import request from '@/utils/request';

// 查询模型树
export function getModellTree(params) {
  return request({
    url: '/isfd/databaseModel/tree/getTree',
    method: 'get',
    params: params
  });
}

// 根据业务信息查询模型树
export function getModellTreeByBusiness(params) {
  return request({
    url: '/isfd/databaseModel/tree/getTreeByBusinessId',
    method: 'get',
    params: params
  });
}

// 新增树节点
export function addModelTreeNode(param) {
  return request({
    url: '/isfd/databaseModel/tree/save',
    method: 'post',
    data: param
  });
}

// 删除树节点/删除模型
export function deleteModelTreeNode(id) {
  return request({
    url: `/isfd/databaseModel/tree/${id}`,
    method: 'delete'
  });
}

// 查询模型列表
export function getElementModel(param) {
  return request({
    url: '/isfd/databaseModel/config/list',
    method: 'post',
    data: param
  });
}

// 查询模型树
export function getModelDetail(params) {
  return request({
    url: '/isfd/databaseModel/config/detail',
    method: 'get',
    params: params
  });
}

// 保存模型
export function saveElementModel(param) {
  return request({
    url: '/isfd/databaseModel/config/save',
    method: 'post',
    data: param
  });
}

// 删除模型
export function deleteElementModel(id) {
  return request({
    url: `/isfd/databaseModel/config/${id}`,
    method: 'delete'
  });
}

// 查询字段类型
export function getFieldTypes(param) {
  return request({
    url: '/isfd/databaseModel/config/getFieldTypes',
    method: 'get',
    params: param
  });
}

// 升版接口
export function upgradeModel(param) {
  return request({
    url: '/isfd/databaseModel/config/upgrade',
    method: 'post',
    data: param
  });
}
